package com.situ.crm;

import java.util.Scanner;

public class TTT {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
//        String word1 = input.nextLine();
//        String word2 = input.nextLine();
        String word1 = "gao";
        String word2 = "zhangsan";
        int len1 = word1.length();
        int len2 = word2.length();
        int[][] array = new int[len1 + 1][len2 + 1];
        for (int i = 0; i <= len2; i++) {
            array[0][i] = i;
        }
        for (int i = 0; i <= len1; i++) {
            array[i][0] = i;
        }

        for (int i = 1; i <= len1; i++)
            for (int j = 1; j <= len2; j++) {
                if (word1.charAt(i - 1) == word2.charAt(j - 1)) {
                    array[i][j] = array[i - 1][j - 1];
                } else {
                    int add = array[i - 1][j] + 1;
                    int del = array[i][j - 1] + 1;
                    int upd = array[i - 1][j - 1] + 1;
                    array[i][j] = Math.min(Math.min(add, del), upd);
                }

            }
        System.out.println(array[len1][len2]);

    }
}
